	<h1><?php echo $cnt_name; ?></h1>
	<div id='c-load'></div>
	<form name='frm' id='frm' action='<?php echo $cnt ?>/remove' method='POST'>
	<div> 
	<input type='button' id='btn_create' name='btn_create' value='เพิ่ม' onclick="window.location='<?php echo $cnt; ?>/create'"/>
	<input type='button' id='btn_remove' name='btn_remove' value='ลบ'/></div>
	<div id='box-table' style='position:relative;'>
	<table >
			<tr>
					<td width='5%'><input type="checkbox" name="all" id="call" value="1"></td>
					<td width='5%'>NO</td>
					<?php foreach($colum as $r=>$k){?>
					<td><?php echo  $k['label']; ?></td>
					<?php } ?>
				
					<td width='20%'>Action</td>
			</tr>
			<?php
			$i=1;
			foreach ($ds  as $row=>$key){?>
			<tr>
					<td><input type="checkbox" name="row[]"  class='cb' value="<?=$key->id?>" id="crow_<?=$key->id?>"></td>
					<td><?php echo $i; ?></td>
					<?php foreach($colum as $r=>$k){?>
					<?php

				if(isset($k['type'])){?>
					<td><a href='<?php  echo $key->$r; ?>' target='_blank'><?php  echo $key->$r; ?></a></td>
					<?php
					} else{?>
					<td><?php  echo $key->$r; ?></td>
					<?php }
					 } ?>
					<td><a href="<?php echo $func?>edit/<?php echo $key->id; ?>">แก้ไข</a> |  <a href="javascript:commandLoad(<?php echo $key->id; ?>);">โหลด</a> </td>
			</tr>
			<?php 
			$i++;
			} ?>
		</table>	
		</div>
		</form>
		<script type="text/javascript">
				$(document).ready(function(){
						$("#call").click(function(){
								  $("input[type='checkbox']").attr('checked', $('#call').is(':checked'));    
		
					});
					$("#btn_remove").click(function(){
									var is_any_checked = false;
									$("[name='row[]']").each( function() {
									if($(this).attr('checked')) is_any_checked = true;
									});
									if(!is_any_checked) {
									alert(' ยังไม่เลือกรายการลบ ');
									return false;
									}		
									if(confirm('คุณต้องการทำรายการลบ จริงหรือไม')){
									$('#frm').submit();
									return true;	
									} else {
									return false;
									}
					
					});
					
				});
			function commandLoad(keyID){
	var _w = $("#box-table").width();
			var _h = $("#box-table").height();
			$("#box-table").append('<div id="box-wait" style="position:absolute; width:'+_w+'px; height:'+_h+'px; opacity:0.6; filter:alpha(opacity=60); top:0px; z-index:1; background:#FFF;"> &nbsp;</div>');
							$('#c-load').css({'width':'580px','border':'1px solid #ccc','height':'150px','overflow':'auto'});
							$.ajax({
							  type: "POST",
							  url: "<?php echo $func?>load/"+keyID,
							  success: function(msg){
						//	  alert(msg);
										$("#c-load").html(msg);
										$("#box-wait").remove();
							  }
							  }); 	/* 	*/
							
			}
		</script>
		

